/*
** fill_eye_fcts1.c for  in /home/chreti_m//projet/RAYTRACER/init_cnf_file
** 
** Made by max chretien
** Login   <chreti_m@epitech.net>
** 
** Started on  Mon Apr 30 02:00:21 2012 max chretien
** Last update Mon Apr 30 17:13:22 2012 canh-kiet le
*/

#include	"rt.h"

void		eye_res(char **tab, t_scene *sc, int line_err)
{
  int		i;

  if (cnt_params(tab) != 3)
    disp_err(tab[0], line_err, "Only need 2 arguments.\n");
  i = 1;
  while (tab[i])
    {
      if (!my_str_isnum(tab[i++]))
	disp_err(tab[0], line_err, "Argument must be only numbers.\n");
    }
  sc->size.x = atoi(tab[1]);
  sc->size.y = atoi(tab[2]);
}

void		eye_oeil(char **tab, t_scene *sc, int line_err)
{
  int		i;

  if (cnt_params(tab) != 4)
    disp_err(tab[0], line_err, "Only need 3 arguments.\n");
  i = 1;
  while (tab[i])
    {
      if (!my_str_isnum(tab[i++]))
	disp_err(tab[0], line_err, "Argument must be only numbers.\n");
    }
  sc->eye.vect.x = atof(tab[1]);
  sc->eye.vect.y = atof(tab[2]);
  sc->eye.vect.z = atof(tab[3]);
}

void		eye_rot(char **tab, t_scene *sc, int line_err)
{
  int		i;

  if (cnt_params(tab) != 4)
    disp_err(tab[0], line_err, "Only need 3 arguments.\n");
  i = 1;
  while (tab[i])
    {
      if (!my_str_isnum(tab[i++]))
	disp_err(tab[0], line_err, "Argument must be only numbers.\n");
    }
  sc->eye.rot.x = atof(tab[1]);
  sc->eye.rot.y = atof(tab[2]);
  sc->eye.rot.z = atof(tab[3]);
}

void		eye_fov(char **tab, t_scene *sc, int line_err)
{
  if (cnt_params(tab) != 2)
    disp_err(tab[0], line_err, "Only need 1 argument");
  if (!my_str_isnum(tab[1]))
    disp_err(tab[0], line_err, "Argument must be only numbers");
  sc->eye.fov = atoi(tab[1]);
}
